suppressPackageStartupMessages(library(tidyverse))
## Warning: package 'ggplot2' was built under R version 4.2.3
## Warning: package 'tidyr' was built under R version 4.2.3
## Warning: package 'readr' was built under R version 4.2.3
## Warning: package 'dplyr' was built under R version 4.2.3
## Warning: package 'stringr' was built under R version 4.2.3
library(patchwork)
## Warning: package 'patchwork' was built under R version 4.2.3
devtools::load_all('~/Google Drive/My Drive/Scripts/R_packages/myUtilities/')
## ℹ Loading myUtilities

Settings

data_dir <- '/Volumes/Mitsu_NGS_3/METTL2A/'

wd <- "~/Google Drive/My Drive/Analysis/METTL2A/"
setwd(wd)

figdir <- paste0(wd, 'Figures/Shortread/Stringtie_tximport_DESeq2_Gprofiler/')
dir.create(figdir, recursive = TRUE)
## Warning in dir.create(figdir, recursive = TRUE): '/Users/s-mitsutomi/Google
## Drive/My
## Drive/Analysis/METTL2A/Figures/Shortread/Stringtie_tximport_DESeq2_Gprofiler'
## already exists
tabledir <- paste0(wd, 'Tables/Shortread/Stringtie_tximport_DESeq2_Gprofiler/')

theme_set(
  theme_classic(base_size = 7) +
    theme(legend.position = 'bottom')
)

Functions

gprofiler_gost <- function(ordered = TRUE, highlight = FALSE) {
  
  gostres <-
    gprofiler2::gost(
      query = list(
        'up'   = str_remove(shortread_stringtie_txi_DESeq2_commonup$gene_id,
                            '[.][0-9]+$'),
        'down' = str_remove(shortread_stringtie_txi_DESeq2_commondown$gene_id,
                            '[.][0-9]+$')
      ),
      organism = 'hsapiens',
      ordered_query = ordered,
      significant = TRUE,
      highlight = highlight,
      #multi_query = TRUE
    )
  gostres$result |>
    as_tibble()
  
}

calc_signed_log10p <- function(df) {
  
  df |> 
    mutate(
      signed_log10p =
        ifelse(query == 'up', -log10(p_value), log10(p_value))
    ) |>
    arrange(p_value)
  
}

quickview_gprofiler_result <- function(df) {
  
  for (gp_source in unique(df$source)) {
    
    df |>
      filter(source == gp_source) |>
      select(query, p_value, term_name, source) |>
      head(20) |>
      print()
    
  }
  
}

# If parent has smaller pvalue, drop the term
simplify_terms <- function(df) {
  
  term_ranks <-
    df |>
    arrange(p_value) |>
    select(rank, query, term_id) |>
    dplyr::rename(
      parent_term_rank = rank, parent_term_id = term_id
    )
  
  df |>
    arrange(p_value) |>
    select(rank, query, signed_log10p, source, term_name,
           term_id, source_order, parents) |>
    unnest_longer(col = parents) |>
    dplyr::rename(parent_term_id = parents) |>
    left_join(term_ranks) |>
    group_by(rank) |> 
    filter(is.na(parent_term_rank) | rank == min(parent_term_rank)) |>
    ungroup() |> 
    select(-starts_with('parent_')) |>
    distinct()
  
} 

dual_barplot_theme <- function() {
  
  theme_classic(base_size = 7) +
    theme(
      axis.title.y = element_blank(),
      axis.text.y  = element_blank(),
      axis.line.y  = element_blank(),
      axis.ticks.y = element_blank()
    )
  
}

plot_dual_barplot_each_source <- function(.source, df) {
  
  barplot_basename <- paste0(
    df |> substitute() |> deparse(), '_', .source, '_dualbarplot'
  )
  
  df_source_simplified <- 
    df |> 
    filter(source == .source) |> 
    rownames_to_column(var = 'rank') 
  # |> 
  #   simplify_terms() 
  # 
  yrange_max <- df_source_simplified$signed_log10p |> abs() |> max(na.rm = TRUE)
  
  p1 <-
    df_source_simplified  |>
    select(query, signed_log10p, term_name, source) |>
    #filter(source == 'GO:BP') |>
    filter(query == 'down') |>
    head(10) |>
    ggplot(aes(x = reorder(term_name, -signed_log10p),
               y = signed_log10p, label = term_name)) +
    geom_bar(stat = 'identity', fill = 'blue', alpha = .2) +
    geom_text(hjust = 1, colour = 'black', y = -0.2, size = 7 * 0.36) +
    scale_y_continuous(limits = c(-yrange_max, 0)) +
    labs(title = .source) +
    coord_flip() +
    dual_barplot_theme()
  
  p2 <-
    df_source_simplified  |>
    select(query, signed_log10p, term_name, source) |>
    #filter(source == 'GO:BP') |>
    filter(query == 'up') |>
    head(10) |>
    ggplot(aes(x = reorder(term_name, signed_log10p),
               y = signed_log10p, label = term_name)) +
    geom_bar(stat = 'identity', fill = 'red', alpha = 0.2) +
    geom_text(hjust = 0, colour = 'black', y = 0.2, size = 7 * 0.36) +
    scale_y_continuous(limits = c(0, yrange_max)) +
    coord_flip() +
    dual_barplot_theme()
  
  dual_barplot <-  p1 | p2
  print(dual_barplot)
  
  ggsave(
    plot = dual_barplot, 
    filename = paste0(figdir, barplot_basename, '.pdf'),
    width = 12, height = 6, units = 'cm',
  )
  
}

Read data

shortread_stringtie_txi_DESeq2 <- read_tsv(
  paste0(
    wd, 
    #'Tables/Shortread/shortread_DESeq2_results_DRSm3C_DETinfo_2024-04-06.tsv'
    'Tables/Shortread/shortread_stringtie_txi_DESeq2_DEG_methylation_2024-04-17.tsv.gz'
    )
  ) |>
  arrange(siMETTL2A_pvalue)
## Rows: 12974 Columns: 27
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: "\t"
## chr  (9): gene_name, gene_id, methylation, isUp, isDown, common_DEGs, gene_t...
## dbl (18): siMETTL2A_baseMean, siMETTL2A_log2FoldChange, siMETTL2A_lfcSE, siM...
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
shortread_stringtie_txi_DESeq2
## # A tibble: 12,974 × 27
##    gene_name siMETTL2A_baseMean siMETTL2A_log2FoldChange siMETTL2A_lfcSE
##    <chr>                  <dbl>                    <dbl>           <dbl>
##  1 LIPH                  45984.                    1.84           0.0597
##  2 ANGPTL2                4420.                    1.92           0.0652
##  3 TMED4                 36154.                    1.28           0.0455
##  4 CPVL                  34696.                    1.71           0.0622
##  5 ANTXR2                31176.                    1.83           0.0743
##  6 RNF26                  8173.                   -1.28           0.0543
##  7 TOMM22                15243.                    0.949          0.0418
##  8 PLAUR                 20487.                    2.32           0.107 
##  9 ERBB3                 14174.                   -1.05           0.0500
## 10 TSC22D1               24238.                    0.876          0.0417
## # ℹ 12,964 more rows
## # ℹ 23 more variables: siMETTL2A_stat <dbl>, siMETTL2A_pvalue <dbl>,
## #   siMETTL2A_padj <dbl>, siMETTL2A_G_baseMean <dbl>,
## #   siMETTL2A_G_log2FoldChange <dbl>, siMETTL2A_G_lfcSE <dbl>,
## #   siMETTL2A_G_stat <dbl>, siMETTL2A_G_pvalue <dbl>, siMETTL2A_G_padj <dbl>,
## #   siMETTL2A_I_baseMean <dbl>, siMETTL2A_I_log2FoldChange <dbl>,
## #   siMETTL2A_I_lfcSE <dbl>, siMETTL2A_I_stat <dbl>, …

Filter common DEGs

shortread_stringtie_txi_DESeq2_commonup <- 
  shortread_stringtie_txi_DESeq2 |> 
  filter(common_DEGs == 'up')
#  filter(common_DETs == 'up')
shortread_stringtie_txi_DESeq2_commonup
## # A tibble: 1,685 × 27
##    gene_name  siMETTL2A_baseMean siMETTL2A_log2FoldChange siMETTL2A_lfcSE
##    <chr>                   <dbl>                    <dbl>           <dbl>
##  1 LIPH                   45984.                    1.84           0.0597
##  2 ANGPTL2                 4420.                    1.92           0.0652
##  3 TMED4                  36154.                    1.28           0.0455
##  4 CPVL                   34696.                    1.71           0.0622
##  5 ANTXR2                 31176.                    1.83           0.0743
##  6 TOMM22                 15243.                    0.949          0.0418
##  7 PLAUR                  20487.                    2.32           0.107 
##  8 TSC22D1                24238.                    0.876          0.0417
##  9 RNF149                 16660.                    1.67           0.0951
## 10 TRMT61A-DT              2523.                    2.75           0.161 
## # ℹ 1,675 more rows
## # ℹ 23 more variables: siMETTL2A_stat <dbl>, siMETTL2A_pvalue <dbl>,
## #   siMETTL2A_padj <dbl>, siMETTL2A_G_baseMean <dbl>,
## #   siMETTL2A_G_log2FoldChange <dbl>, siMETTL2A_G_lfcSE <dbl>,
## #   siMETTL2A_G_stat <dbl>, siMETTL2A_G_pvalue <dbl>, siMETTL2A_G_padj <dbl>,
## #   siMETTL2A_I_baseMean <dbl>, siMETTL2A_I_log2FoldChange <dbl>,
## #   siMETTL2A_I_lfcSE <dbl>, siMETTL2A_I_stat <dbl>, …
shortread_stringtie_txi_DESeq2_commondown <- 
  shortread_stringtie_txi_DESeq2 |> 
  filter(common_DEGs == 'down')
shortread_stringtie_txi_DESeq2_commondown
## # A tibble: 1,805 × 27
##    gene_name siMETTL2A_baseMean siMETTL2A_log2FoldChange siMETTL2A_lfcSE
##    <chr>                  <dbl>                    <dbl>           <dbl>
##  1 RNF26                  8173.                   -1.28           0.0543
##  2 ERBB3                 14174.                   -1.05           0.0500
##  3 PCNA                  12488.                   -1.65           0.0789
##  4 HAUS1                  2470.                   -1.49           0.0717
##  5 HMGB2                  9558.                   -1.39           0.0746
##  6 SHCBP1                 9012.                   -1.24           0.0715
##  7 BLMH                   9459.                   -0.995          0.0574
##  8 CCNB2                  3962.                   -1.90           0.110 
##  9 ACADSB                  984.                   -1.38           0.0813
## 10 TADA3                  5293.                   -0.932          0.0584
## # ℹ 1,795 more rows
## # ℹ 23 more variables: siMETTL2A_stat <dbl>, siMETTL2A_pvalue <dbl>,
## #   siMETTL2A_padj <dbl>, siMETTL2A_G_baseMean <dbl>,
## #   siMETTL2A_G_log2FoldChange <dbl>, siMETTL2A_G_lfcSE <dbl>,
## #   siMETTL2A_G_stat <dbl>, siMETTL2A_G_pvalue <dbl>, siMETTL2A_G_padj <dbl>,
## #   siMETTL2A_I_baseMean <dbl>, siMETTL2A_I_log2FoldChange <dbl>,
## #   siMETTL2A_I_lfcSE <dbl>, siMETTL2A_I_stat <dbl>, …

Enrichment analysis using gprofiler

gprofiler_result_ordered <- 
  gprofiler_gost(ordered = TRUE) |> 
  calc_signed_log10p()
gprofiler_result_ordered |> 
  export_tsv(outdir = tabledir, compression = 'gz')
## 
## Exported to: ~/Google Drive/My Drive/Analysis/METTL2A/Tables/Shortread/Stringtie_tximport_DESeq2_Gprofiler/gprofiler_result_ordered_2024-07-30.tsv.gz
## # A tibble: 1,183 × 15
##    query significant  p_value term_size query_size intersection_size precision
##    <chr> <lgl>          <dbl>     <int>      <int>             <int>     <dbl>
##  1 down  TRUE        7.68e-60      4220       1805               631    0.350 
##  2 down  TRUE        3.08e-44      1276       1429               235    0.164 
##  3 down  TRUE        9.49e-44      1040       1760               234    0.133 
##  4 down  TRUE        1.80e-43      1819       1018               235    0.231 
##  5 down  TRUE        1.97e-40       635       1540               157    0.102 
##  6 down  TRUE        4.31e-39       281       1167                88    0.0754
##  7 down  TRUE        6.50e-39       402       1302               107    0.0822
##  8 down  TRUE        4.14e-38      5487       1805               693    0.384 
##  9 down  TRUE        6.82e-38       162        826                59    0.0714
## 10 down  TRUE        2.27e-37       425       1711               128    0.0748
## # ℹ 1,173 more rows
## # ℹ 8 more variables: recall <dbl>, term_id <chr>, source <chr>,
## #   term_name <chr>, effective_domain_size <int>, source_order <int>,
## #   parents <list>, signed_log10p <dbl>
gprofiler_result_notordered <- 
  gprofiler_gost(ordered = FALSE) |> 
  calc_signed_log10p()
gprofiler_result_notordered |> 
  export_tsv(outdir = tabledir, compression = 'gz')
## 
## Exported to: ~/Google Drive/My Drive/Analysis/METTL2A/Tables/Shortread/Stringtie_tximport_DESeq2_Gprofiler/gprofiler_result_notordered_2024-07-30.tsv.gz
## # A tibble: 3,083 × 15
##    query significant  p_value term_size query_size intersection_size precision
##    <chr> <lgl>          <dbl>     <int>      <int>             <int>     <dbl>
##  1 down  TRUE        3.14e-79      4220       1636               631     0.386
##  2 up    TRUE        5.16e-68     12345       1404              1093     0.778
##  3 down  TRUE        2.89e-67     12345       1636              1245     0.761
##  4 down  TRUE        2.33e-56      5487       1636               693     0.424
##  5 down  TRUE        3.91e-56      1819       1587               338     0.213
##  6 down  TRUE        7.13e-56      7899       1141              1030     0.903
##  7 down  TRUE        1.97e-54      1276       1587               269     0.170
##  8 down  TRUE        1.24e-53       677       1094               211     0.193
##  9 down  TRUE        4.13e-53      1040       1587               236     0.149
## 10 down  TRUE        3.06e-52     16076       1687              1574     0.933
## # ℹ 3,073 more rows
## # ℹ 8 more variables: recall <dbl>, term_id <chr>, source <chr>,
## #   term_name <chr>, effective_domain_size <int>, source_order <int>,
## #   parents <list>, signed_log10p <dbl>
gprofiler_result_highlighted <- 
  gprofiler_gost(ordered = FALSE, highlight = TRUE) |> 
  calc_signed_log10p() |> 
  filter(highlighted == TRUE)
gprofiler_result_highlighted |> 
  export_tsv(outdir = tabledir, compression = 'gz')
## 
## Exported to: ~/Google Drive/My Drive/Analysis/METTL2A/Tables/Shortread/Stringtie_tximport_DESeq2_Gprofiler/gprofiler_result_highlighted_2024-07-30.tsv.gz
## # A tibble: 61 × 16
##    query significant  p_value term_size query_size intersection_size precision
##    <chr> <lgl>          <dbl>     <int>      <int>             <int>     <dbl>
##  1 down  TRUE        3.14e-79      4220       1636               631    0.386 
##  2 up    TRUE        5.16e-68     12345       1404              1093    0.778 
##  3 down  TRUE        3.91e-56      1819       1587               338    0.213 
##  4 down  TRUE        4.13e-53      1040       1587               236    0.149 
##  5 down  TRUE        6.91e-44     14838       1631              1426    0.874 
##  6 up    TRUE        5.08e-36     14838       1391              1214    0.873 
##  7 down  TRUE        7.13e-31       656       1587               147    0.0926
##  8 down  TRUE        4.97e-25      5758       1631               661    0.405 
##  9 up    TRUE        2.43e-23      4912       1328               477    0.359 
## 10 down  TRUE        1.29e-20       436       1636                97    0.0593
## # ℹ 51 more rows
## # ℹ 9 more variables: recall <dbl>, term_id <chr>, source <chr>,
## #   term_name <chr>, effective_domain_size <int>, source_order <int>,
## #   parents <list>, highlighted <lgl>, signed_log10p <dbl>
gprofiler_result_ordered
## # A tibble: 1,183 × 15
##    query significant  p_value term_size query_size intersection_size precision
##    <chr> <lgl>          <dbl>     <int>      <int>             <int>     <dbl>
##  1 down  TRUE        7.68e-60      4220       1805               631    0.350 
##  2 down  TRUE        3.08e-44      1276       1429               235    0.164 
##  3 down  TRUE        9.49e-44      1040       1760               234    0.133 
##  4 down  TRUE        1.80e-43      1819       1018               235    0.231 
##  5 down  TRUE        1.97e-40       635       1540               157    0.102 
##  6 down  TRUE        4.31e-39       281       1167                88    0.0754
##  7 down  TRUE        6.50e-39       402       1302               107    0.0822
##  8 down  TRUE        4.14e-38      5487       1805               693    0.384 
##  9 down  TRUE        6.82e-38       162        826                59    0.0714
## 10 down  TRUE        2.27e-37       425       1711               128    0.0748
## # ℹ 1,173 more rows
## # ℹ 8 more variables: recall <dbl>, term_id <chr>, source <chr>,
## #   term_name <chr>, effective_domain_size <int>, source_order <int>,
## #   parents <list>, signed_log10p <dbl>

Briefly check gprofiler results grouped by source

quickview_gprofiler_result(gprofiler_result_ordered)
## # A tibble: 20 × 4
##    query  p_value term_name                                source
##    <chr>    <dbl> <chr>                                    <chr> 
##  1 down  7.68e-60 nucleoplasm                              GO:CC 
##  2 down  6.50e-39 chromosomal region                       GO:CC 
##  3 down  4.14e-38 cytosol                                  GO:CC 
##  4 down  7.18e-34 chromosome                               GO:CC 
##  5 down  3.30e-30 cytoplasm                                GO:CC 
##  6 down  3.83e-30 membrane-enclosed lumen                  GO:CC 
##  7 down  3.83e-30 organelle lumen                          GO:CC 
##  8 down  3.83e-30 intracellular organelle lumen            GO:CC 
##  9 down  4.61e-30 nuclear lumen                            GO:CC 
## 10 down  6.02e-27 chromosome, centromeric region           GO:CC 
## 11 down  4.24e-26 condensed chromosome                     GO:CC 
## 12 down  4.36e-23 condensed chromosome, centromeric region GO:CC 
## 13 down  7.84e-23 kinetochore                              GO:CC 
## 14 up    1.43e-20 endomembrane system                      GO:CC 
## 15 down  8.22e-20 microtubule cytoskeleton                 GO:CC 
## 16 down  7.61e-19 nuclear chromosome                       GO:CC 
## 17 down  1.42e-18 replication fork                         GO:CC 
## 18 down  3.96e-18 spindle                                  GO:CC 
## 19 up    8.10e-18 vesicle                                  GO:CC 
## 20 down  5.05e-16 centrosome                               GO:CC 
## # A tibble: 20 × 4
##    query  p_value term_name                            source
##    <chr>    <dbl> <chr>                                <chr> 
##  1 down  3.08e-44 cell cycle process                   GO:BP 
##  2 down  9.49e-44 DNA metabolic process                GO:BP 
##  3 down  1.80e-43 cell cycle                           GO:BP 
##  4 down  1.97e-40 chromosome organization              GO:BP 
##  5 down  4.31e-39 DNA replication                      GO:BP 
##  6 down  6.82e-38 DNA-templated DNA replication        GO:BP 
##  7 down  2.27e-37 chromosome segregation               GO:BP 
##  8 down  1.93e-35 DNA repair                           GO:BP 
##  9 down  8.85e-35 mitotic cell cycle                   GO:BP 
## 10 down  7.65e-33 mitotic cell cycle process           GO:BP 
## 11 down  3.39e-30 DNA damage response                  GO:BP 
## 12 down  4.78e-29 sister chromatid segregation         GO:BP 
## 13 down  6.22e-29 mitotic sister chromatid segregation GO:BP 
## 14 down  4.56e-26 nuclear chromosome segregation       GO:BP 
## 15 down  1.82e-25 cell division                        GO:BP 
## 16 down  5.04e-25 regulation of cell cycle process     GO:BP 
## 17 down  9.09e-25 regulation of cell cycle             GO:BP 
## 18 down  2.67e-23 double-strand break repair           GO:BP 
## 19 down  4.93e-23 DNA recombination                    GO:BP 
## 20 down  7.60e-23 recombinational repair               GO:BP 
## # A tibble: 20 × 4
##    query  p_value term_name                                               source
##    <chr>    <dbl> <chr>                                                   <chr> 
##  1 down  2.90e-23 Cell Cycle                                              REAC  
##  2 down  5.12e-22 Cell Cycle, Mitotic                                     REAC  
##  3 down  2.51e-17 DNA strand elongation                                   REAC  
##  4 down  2.18e-15 Activation of the pre-replicative complex               REAC  
##  5 down  5.78e-14 Cell Cycle Checkpoints                                  REAC  
##  6 down  3.62e-13 Mitotic G1 phase and G1/S transition                    REAC  
##  7 down  4.71e-13 G1/S Transition                                         REAC  
##  8 down  6.44e-13 S Phase                                                 REAC  
##  9 down  2.00e-12 Mitotic Prometaphase                                    REAC  
## 10 down  2.45e-11 Activation of ATR in response to replication stress     REAC  
## 11 down  2.91e-11 Synthesis of DNA                                        REAC  
## 12 down  1.36e-10 Resolution of Sister Chromatid Cohesion                 REAC  
## 13 down  3.16e-10 Unwinding of DNA                                        REAC  
## 14 down  3.64e-10 Amplification  of signal from unattached  kinetochores… REAC  
## 15 down  3.64e-10 Amplification of signal from the kinetochores           REAC  
## 16 down  1.58e- 9 Mitotic Spindle Checkpoint                              REAC  
## 17 down  4.76e- 9 Mitotic Metaphase and Anaphase                          REAC  
## 18 down  1.03e- 8 Mitotic Anaphase                                        REAC  
## 19 down  1.06e- 8 Telomere C-strand (Lagging Strand) Synthesis            REAC  
## 20 down  1.32e- 8 EML4 and NUDC in mitotic spindle formation              REAC  
## # A tibble: 20 × 4
##    query  p_value term_name                                           source
##    <chr>    <dbl> <chr>                                               <chr> 
##  1 down  5.85e-19 Factor: E2F-4; motif: NTTTCSCGCC; match class: 1    TF    
##  2 down  2.54e-18 Factor: E2F-4; motif: NTTTCSCGCC                    TF    
##  3 down  7.90e-18 Factor: ER81; motif: RCCGGAARYN; match class: 1     TF    
##  4 down  1.18e-16 Factor: E2F-1; motif: NNNSSCGCSAANN                 TF    
##  5 down  6.77e-16 Factor: ZF5; motif: GSGCGCGR; match class: 1        TF    
##  6 down  3.16e-15 Factor: E2F-1; motif: TTTSGCGS                      TF    
##  7 down  6.98e-15 Factor: E2F-1:DP-1; motif: TTTCSCGC                 TF    
##  8 down  9.64e-15 Factor: E2F-4:DP-1; motif: TTTSGCGC                 TF    
##  9 down  1.03e-14 Factor: SAP-1; motif: NNCCGGAAGTGN                  TF    
## 10 down  1.30e-14 Factor: E2F-2; motif: GCGCGCGCGYW                   TF    
## 11 down  2.45e-14 Factor: ZF5; motif: GGSGCGCGS; match class: 1       TF    
## 12 down  2.81e-14 Factor: E2F; motif: GGCGSG                          TF    
## 13 down  2.89e-14 Factor: E2F-4; motif: SNGGGCGGGAANN; match class: 1 TF    
## 14 down  3.75e-14 Factor: E2F-1; motif: TTTSGCGS; match class: 1      TF    
## 15 down  3.97e-14 Factor: Elk-1; motif: NNNNCCGGAARTNN                TF    
## 16 down  4.23e-14 Factor: E2F; motif: TTTCGCGC; match class: 1        TF    
## 17 down  1.05e-13 Factor: E2F-4; motif: NNTTCCCGCCNN                  TF    
## 18 down  1.07e-13 Factor: FLI-1; motif: NAYTTCCGGT                    TF    
## 19 down  1.43e-13 Factor: E2F-1; motif: NTTTCGCGCS                    TF    
## 20 down  2.46e-13 Factor: E2F; motif: NNTTTCGCGCN                     TF    
## # A tibble: 20 × 4
##    query  p_value term_name                                    source
##    <chr>    <dbl> <chr>                                        <chr> 
##  1 down  4.56e-18 catalytic activity, acting on a nucleic acid GO:MF 
##  2 down  2.65e-17 single-stranded DNA binding                  GO:MF 
##  3 down  1.07e-12 catalytic activity                           GO:MF 
##  4 down  1.41e-11 catalytic activity, acting on DNA            GO:MF 
##  5 down  3.29e-11 DNA secondary structure binding              GO:MF 
##  6 down  4.09e-11 ATP-dependent activity, acting on DNA        GO:MF 
##  7 down  7.77e-11 single-stranded DNA helicase activity        GO:MF 
##  8 down  2.72e-10 nucleotide binding                           GO:MF 
##  9 down  2.87e-10 nucleoside phosphate binding                 GO:MF 
## 10 down  3.14e-10 heterocyclic compound binding                GO:MF 
## 11 down  6.78e- 9 DNA helicase activity                        GO:MF 
## 12 down  1.47e- 8 adenyl nucleotide binding                    GO:MF 
## 13 down  3.15e- 8 catalytic activity, acting on RNA            GO:MF 
## 14 down  3.15e- 8 four-way junction DNA binding                GO:MF 
## 15 down  5.05e- 8 transferase activity                         GO:MF 
## 16 down  6.47e- 8 ATP binding                                  GO:MF 
## 17 down  9.17e- 8 purine nucleotide binding                    GO:MF 
## 18 down  1.22e- 7 damaged DNA binding                          GO:MF 
## 19 down  2.92e- 7 purine ribonucleoside triphosphate binding   GO:MF 
## 20 down  3.96e- 7 DNA binding                                  GO:MF 
## # A tibble: 9 × 4
##   query  p_value term_name                        source
##   <chr>    <dbl> <chr>                            <chr> 
## 1 down  2.96e-16 Retinoblastoma gene in cancer    WP    
## 2 down  6.29e-16 DNA replication                  WP    
## 3 down  1.37e- 7 G1 to S cell cycle control       WP    
## 4 down  8.54e- 7 DNA mismatch repair              WP    
## 5 down  5.95e- 6 DNA repair pathways full network WP    
## 6 down  3.33e- 4 Cell cycle                       WP    
## 7 down  5.78e- 4 Base excision repair             WP    
## 8 down  3.62e- 3 Nucleotide excision repair       WP    
## 9 down  3.13e- 2 Gastric cancer network 1         WP    
## # A tibble: 7 × 4
##   query  p_value term_name       source
##   <chr>    <dbl> <chr>           <chr> 
## 1 down  8.50e-14 hsa-miR-193b-3p MIRNA 
## 2 down  2.10e-12 hsa-miR-215-5p  MIRNA 
## 3 down  2.09e- 8 hsa-miR-192-5p  MIRNA 
## 4 up    5.73e- 3 hsa-miR-1296-3p MIRNA 
## 5 up    1.46e- 2 hsa-miR-668-3p  MIRNA 
## 6 up    2.31e- 2 hsa-miR-29b-3p  MIRNA 
## 7 up    4.43e- 2 hsa-miR-29c-3p  MIRNA 
## # A tibble: 7 × 4
##   query  p_value term_name                  source
##   <chr>    <dbl> <chr>                      <chr> 
## 1 down  1.42e-12 DNA replication            KEGG  
## 2 down  8.08e- 7 Cell cycle                 KEGG  
## 3 down  2.01e- 5 Base excision repair       KEGG  
## 4 down  1.69e- 4 Mismatch repair            KEGG  
## 5 down  8.14e- 4 Homologous recombination   KEGG  
## 6 down  4.54e- 3 Fanconi anemia pathway     KEGG  
## 7 down  2.22e- 2 Nucleotide excision repair KEGG  
## # A tibble: 8 × 4
##   query p_value term_name                       source
##   <chr>   <dbl> <chr>                           <chr> 
## 1 down   0.0104 duodenum; endocrine cells[High] HPA   
## 2 down   0.0123 duodenum; enterocytes[≥Medium]  HPA   
## 3 down   0.0163 skin 1; eccrine glands[≥Medium] HPA   
## 4 down   0.0321 rectum; enterocytes[≥Medium]    HPA   
## 5 down   0.0369 skin 1; eccrine glands[≥Low]    HPA   
## 6 down   0.0394 duodenum; endocrine cells[≥Low] HPA   
## 7 down   0.0448 duodenum; enterocytes[≥Low]     HPA   
## 8 down   0.0473 skin 1; lymphocytes[High]       HPA   
## # A tibble: 3 × 4
##   query p_value term_name                            source
##   <chr>   <dbl> <chr>                                <chr> 
## 1 down   0.0243 DNA synthesome complex (15 subunits) CORUM 
## 2 down   0.0333 DNA synthesome complex (17 subunits) CORUM 
## 3 down   0.0333 DNA synthesome complex (17 subunits) CORUM
quickview_gprofiler_result(gprofiler_result_notordered)
## # A tibble: 20 × 4
##    query  p_value term_name                                source
##    <chr>    <dbl> <chr>                                    <chr> 
##  1 down  3.14e-79 nucleoplasm                              GO:CC 
##  2 up    5.16e-68 cytoplasm                                GO:CC 
##  3 down  2.89e-67 cytoplasm                                GO:CC 
##  4 down  2.33e-56 cytosol                                  GO:CC 
##  5 down  5.74e-49 intracellular organelle lumen            GO:CC 
##  6 down  5.74e-49 membrane-enclosed lumen                  GO:CC 
##  7 down  5.74e-49 organelle lumen                          GO:CC 
##  8 down  3.56e-46 nuclear lumen                            GO:CC 
##  9 down  1.11e-45 intracellular anatomical structure       GO:CC 
## 10 up    6.81e-43 endomembrane system                      GO:CC 
## 11 down  8.52e-41 membrane-bounded organelle               GO:CC 
## 12 down  2.55e-39 intracellular membrane-bounded organelle GO:CC 
## 13 down  2.61e-39 chromosomal region                       GO:CC 
## 14 down  1.54e-38 intracellular organelle                  GO:CC 
## 15 down  1.23e-37 organelle                                GO:CC 
## 16 up    1.78e-36 vesicle                                  GO:CC 
## 17 down  4.97e-35 chromosome                               GO:CC 
## 18 up    2.06e-31 organelle membrane                       GO:CC 
## 19 down  3.25e-29 condensed chromosome                     GO:CC 
## 20 down  1.47e-27 chromosome, centromeric region           GO:CC 
## # A tibble: 20 × 4
##    query  p_value term_name                            source
##    <chr>    <dbl> <chr>                                <chr> 
##  1 down  3.91e-56 cell cycle                           GO:BP 
##  2 down  1.97e-54 cell cycle process                   GO:BP 
##  3 down  4.13e-53 DNA metabolic process                GO:BP 
##  4 down  4.58e-46 chromosome organization              GO:BP 
##  5 down  3.47e-43 chromosome segregation               GO:BP 
##  6 down  5.81e-42 mitotic cell cycle                   GO:BP 
##  7 down  9.72e-42 DNA repair                           GO:BP 
##  8 down  2.37e-39 DNA replication                      GO:BP 
##  9 down  1.60e-38 mitotic cell cycle process           GO:BP 
## 10 down  9.48e-37 DNA damage response                  GO:BP 
## 11 down  1.22e-36 DNA-templated DNA replication        GO:BP 
## 12 down  4.74e-32 sister chromatid segregation         GO:BP 
## 13 down  5.18e-32 mitotic sister chromatid segregation GO:BP 
## 14 down  7.13e-31 cell division                        GO:BP 
## 15 down  2.38e-29 nuclear chromosome segregation       GO:BP 
## 16 down  1.27e-28 regulation of cell cycle process     GO:BP 
## 17 down  1.68e-28 organelle organization               GO:BP 
## 18 down  2.93e-28 regulation of cell cycle             GO:BP 
## 19 down  8.07e-27 organelle fission                    GO:BP 
## 20 down  9.33e-27 double-strand break repair           GO:BP 
## # A tibble: 20 × 4
##    query  p_value term_name                                  source
##    <chr>    <dbl> <chr>                                      <chr> 
##  1 down  7.13e-56 duodenum                                   HPA   
##  2 down  5.43e-46 small intestine                            HPA   
##  3 down  3.11e-45 rectum                                     HPA   
##  4 down  1.84e-43 stomach 2; glandular cells[≥Low]           HPA   
##  5 down  1.84e-43 stomach 2                                  HPA   
##  6 down  2.09e-41 gallbladder                                HPA   
##  7 down  2.09e-41 gallbladder; glandular cells[≥Low]         HPA   
##  8 down  5.75e-41 colon                                      HPA   
##  9 down  1.09e-40 appendix                                   HPA   
## 10 down  1.65e-39 stomach 1; glandular cells[≥Low]           HPA   
## 11 down  1.65e-39 stomach 1                                  HPA   
## 12 down  5.97e-37 urinary bladder                            HPA   
## 13 down  5.97e-37 urinary bladder; urothelial cells[≥Low]    HPA   
## 14 down  1.52e-36 duodenum; glandular cells[≥Low]            HPA   
## 15 down  4.04e-35 esophagus; squamous epithelial cells[≥Low] HPA   
## 16 down  4.04e-35 esophagus                                  HPA   
## 17 down  2.05e-34 pancreas; exocrine glandular cells[≥Low]   HPA   
## 18 down  2.24e-34 colon; glandular cells[≥Low]               HPA   
## 19 down  3.57e-33 rectum; glandular cells[≥Low]              HPA   
## 20 down  4.03e-33 tonsil                                     HPA   
## # A tibble: 20 × 4
##    query  p_value term_name                                               source
##    <chr>    <dbl> <chr>                                                   <chr> 
##  1 down  1.24e-53 Cell Cycle                                              REAC  
##  2 down  2.00e-47 Cell Cycle, Mitotic                                     REAC  
##  3 down  1.17e-25 Cell Cycle Checkpoints                                  REAC  
##  4 down  8.11e-23 M Phase                                                 REAC  
##  5 down  2.96e-22 Mitotic Prometaphase                                    REAC  
##  6 down  4.08e-22 Mitotic Metaphase and Anaphase                          REAC  
##  7 down  1.49e-21 Mitotic Anaphase                                        REAC  
##  8 down  3.85e-19 S Phase                                                 REAC  
##  9 down  5.92e-19 Resolution of Sister Chromatid Cohesion                 REAC  
## 10 down  8.53e-18 Mitotic G1 phase and G1/S transition                    REAC  
## 11 down  8.21e-17 G1/S Transition                                         REAC  
## 12 down  3.21e-16 Activation of the pre-replicative complex               REAC  
## 13 down  8.18e-16 Mitotic Spindle Checkpoint                              REAC  
## 14 down  2.46e-15 DNA strand elongation                                   REAC  
## 15 down  2.49e-15 Separation of Sister Chromatids                         REAC  
## 16 down  3.14e-15 Synthesis of DNA                                        REAC  
## 17 down  4.97e-15 RHO GTPases Activate Formins                            REAC  
## 18 down  5.60e-15 Amplification  of signal from unattached  kinetochores… REAC  
## 19 down  5.60e-15 Amplification of signal from the kinetochores           REAC  
## 20 down  1.05e-14 EML4 and NUDC in mitotic spindle formation              REAC  
## # A tibble: 20 × 4
##    query  p_value term_name                                               source
##    <chr>    <dbl> <chr>                                                   <chr> 
##  1 down  3.06e-52 Factor: E2F4; motif: YCCCGCCNCNNSSNNSNN; match class: 1 TF    
##  2 down  2.10e-47 Factor: ZF5; motif: GGSGCGCGS; match class: 1           TF    
##  3 down  3.26e-45 Factor: ZF5; motif: GSGCGCGR; match class: 1            TF    
##  4 down  4.34e-44 Factor: E2F-4; motif: NTTTCSCGCC                        TF    
##  5 down  2.11e-41 Factor: E2F-4; motif: SNGGGCGGGAANN; match class: 1     TF    
##  6 down  3.17e-41 Factor: ZF5; motif: GGSGCGCGS                           TF    
##  7 down  4.16e-41 Factor: E2F-3:HES-7; motif: NNNSGCGCSNNNNNCRCGYGNN; ma… TF    
##  8 down  5.75e-41 Factor: ZF5; motif: GSGCGCGR                            TF    
##  9 up    3.61e-39 Factor: ZF5; motif: GGSGCGCGS; match class: 1           TF    
## 10 down  4.97e-39 Factor: E2F-2; motif: GCGCGCGCGYW                       TF    
## 11 up    6.89e-38 Factor: E2F-3:HES-7; motif: NNNSGCGCSNNNNNCRCGYGNN; ma… TF    
## 12 down  9.05e-38 Factor: E2F-1; motif: NGGGCGGGARV                       TF    
## 13 down  1.81e-37 Factor: E2F; motif: GGCGSG                              TF    
## 14 up    2.22e-37 Factor: E2F-3; motif: GGCGGGN                           TF    
## 15 down  3.76e-37 Factor: E2F-1; motif: NNNNGGCGGGAARN                    TF    
## 16 up    3.83e-37 Factor: ZF5; motif: GSGCGCGR; match class: 1            TF    
## 17 up    5.88e-37 Factor: Sp1; motif: NNGGGGCGGGGNN                       TF    
## 18 up    8.13e-37 Factor: E2F4; motif: YCCCGCCNCNNSSNNSNN; match class: 1 TF    
## 19 up    9.41e-37 Factor: E2F-4; motif: SNGGGCGGGAANN; match class: 1     TF    
## 20 down  4.89e-36 Factor: E2F-4; motif: SNGGGCGGGAANN                     TF    
## # A tibble: 20 × 4
##    query  p_value term_name                                    source
##    <chr>    <dbl> <chr>                                        <chr> 
##  1 down  6.91e-44 protein binding                              GO:MF 
##  2 up    5.08e-36 protein binding                              GO:MF 
##  3 down  4.97e-25 catalytic activity                           GO:MF 
##  4 down  3.52e-21 catalytic activity, acting on a nucleic acid GO:MF 
##  5 down  9.21e-16 heterocyclic compound binding                GO:MF 
##  6 down  1.01e-15 nucleotide binding                           GO:MF 
##  7 down  1.08e-15 nucleoside phosphate binding                 GO:MF 
##  8 down  1.64e-13 transferase activity                         GO:MF 
##  9 down  3.20e-13 single-stranded DNA binding                  GO:MF 
## 10 down  8.73e-13 adenyl nucleotide binding                    GO:MF 
## 11 down  2.22e-12 purine nucleotide binding                    GO:MF 
## 12 down  7.92e-12 ATP binding                                  GO:MF 
## 13 down  1.51e-11 purine ribonucleoside triphosphate binding   GO:MF 
## 14 down  2.51e-11 enzyme binding                               GO:MF 
## 15 down  2.58e-11 anion binding                                GO:MF 
## 16 down  3.27e-11 ribonucleotide binding                       GO:MF 
## 17 down  5.31e-11 catalytic activity, acting on DNA            GO:MF 
## 18 down  6.19e-11 adenyl ribonucleotide binding                GO:MF 
## 19 down  1.25e-10 purine ribonucleotide binding                GO:MF 
## 20 down  7.78e-10 catalytic activity, acting on RNA            GO:MF 
## # A tibble: 20 × 4
##    query  p_value term_name                                               source
##    <chr>    <dbl> <chr>                                                   <chr> 
##  1 down  2.70e-24 "Retinoblastoma gene in cancer"                         WP    
##  2 down  3.71e-19 "DNA replication"                                       WP    
##  3 down  1.73e-12 "DNA repair pathways full network"                      WP    
##  4 down  2.44e-12 "Cell cycle"                                            WP    
##  5 down  5.21e-11 "G1 to S cell cycle control"                            WP    
##  6 down  3.03e- 7 "DNA IR damage and cellular response via ATR"           WP    
##  7 down  8.50e- 6 "DNA mismatch repair"                                   WP    
##  8 down  9.85e- 5 "Base excision repair"                                  WP    
##  9 up    7.07e- 3 "Primary focal segmental glomerulosclerosis FSGS "      WP    
## 10 up    8.60e- 3 "Glycosaminoglycan degradation"                         WP    
## 11 down  1.36e- 2 "Cohesin complex Cornelia de Lange syndrome"            WP    
## 12 up    1.59e- 2 "Electron transport chain OXPHOS system in mitochondri… WP    
## 13 up    1.79e- 2 "IL 26 signaling pathways"                              WP    
## 14 up    1.93e- 2 "Ciliary landscape"                                     WP    
## 15 up    2.10e- 2 "Ebola virus infection in host"                         WP    
## 16 down  2.17e- 2 "DNA damage response"                                   WP    
## 17 down  2.63e- 2 "Gastric cancer network 2"                              WP    
## 18 up    2.80e- 2 "Apoptosis related network due to altered Notch3 in ov… WP    
## 19 up    3.32e- 2 "VEGFA VEGFR2 signaling"                                WP    
## 20 down  3.99e- 2 "Regulation of sister chromatid separation at the meta… WP    
## # A tibble: 20 × 4
##    query  p_value term_name       source
##    <chr>    <dbl> <chr>           <chr> 
##  1 down  9.15e-22 hsa-miR-193b-3p MIRNA 
##  2 down  4.16e-18 hsa-miR-215-5p  MIRNA 
##  3 down  8.67e-14 hsa-miR-192-5p  MIRNA 
##  4 up    2.27e- 6 hsa-miR-17-5p   MIRNA 
##  5 up    1.47e- 4 hsa-miR-93-5p   MIRNA 
##  6 up    2.18e- 4 hsa-miR-106a-5p MIRNA 
##  7 up    3.76e- 4 hsa-miR-20b-5p  MIRNA 
##  8 down  7.32e- 4 hsa-miR-484     MIRNA 
##  9 up    8.34e- 4 hsa-miR-20a-5p  MIRNA 
## 10 up    1.71e- 3 hsa-miR-519d-3p MIRNA 
## 11 up    2.58e- 3 hsa-miR-106b-5p MIRNA 
## 12 up    3.21e- 3 hsa-let-7e-5p   MIRNA 
## 13 up    1.15e- 2 hsa-miR-526b-3p MIRNA 
## 14 up    1.24e- 2 hsa-miR-519b-3p MIRNA 
## 15 up    1.29e- 2 hsa-miR-98-5p   MIRNA 
## 16 up    1.42e- 2 hsa-miR-30a-5p  MIRNA 
## 17 up    1.47e- 2 hsa-let-7a-5p   MIRNA 
## 18 down  1.60e- 2 hsa-miR-186-5p  MIRNA 
## 19 down  1.70e- 2 hsa-miR-16-5p   MIRNA 
## 20 up    1.89e- 2 hsa-miR-519a-3p MIRNA 
## # A tibble: 20 × 4
##    query  p_value term_name                     source
##    <chr>    <dbl> <chr>                         <chr> 
##  1 down  5.68e-18 Cell cycle                    KEGG  
##  2 down  2.55e-13 DNA replication               KEGG  
##  3 up    3.50e-13 Lysosome                      KEGG  
##  4 down  1.56e- 7 Fanconi anemia pathway        KEGG  
##  5 down  1.22e- 6 Homologous recombination      KEGG  
##  6 down  4.71e- 6 Base excision repair          KEGG  
##  7 down  8.73e- 5 Nucleocytoplasmic transport   KEGG  
##  8 up    1.50e- 4 Oxidative phosphorylation     KEGG  
##  9 up    3.46e- 4 Alzheimer disease             KEGG  
## 10 down  3.50e- 4 Mismatch repair               KEGG  
## 11 down  7.88e- 4 Biosynthesis of cofactors     KEGG  
## 12 up    1.00e- 3 Phagosome                     KEGG  
## 13 down  1.82e- 3 Pentose phosphate pathway     KEGG  
## 14 up    5.82e- 3 Glycosaminoglycan degradation KEGG  
## 15 down  6.22e- 3 Biosynthesis of amino acids   KEGG  
## 16 down  7.13e- 3 Cellular senescence           KEGG  
## 17 up    1.06e- 2 Parkinson disease             KEGG  
## 18 up    1.12e- 2 Diabetic cardiomyopathy       KEGG  
## 19 down  1.26e- 2 Nucleotide metabolism         KEGG  
## 20 down  1.62e- 2 RNA degradation               KEGG  
## # A tibble: 20 × 4
##    query      p_value term_name                                           source
##    <chr>        <dbl> <chr>                                               <chr> 
##  1 down  0.0000000863 Decreased head circumference                        HP    
##  2 down  0.000000121  Microcephaly                                        HP    
##  3 down  0.000000440  Aplasia/Hypoplasia of the cerebrum                  HP    
##  4 down  0.000000711  Abnormal cerebral morphology                        HP    
##  5 down  0.000000821  Abnormal forebrain morphology                       HP    
##  6 up    0.00000504   Distal peripheral sensory neuropathy                HP    
##  7 down  0.00000576   Aplasia/Hypoplasia involving the central nervous s… HP    
##  8 down  0.00000720   Pyridoxine-responsive sideroblastic anemia          HP    
##  9 down  0.0000133    Abnormality of skull size                           HP    
## 10 down  0.0000221    Duodenal stenosis                                   HP    
## 11 down  0.0000221    Small intestinal stenosis                           HP    
## 12 down  0.0000324    Absent testis                                       HP    
## 13 up    0.0000437    Dementia                                            HP    
## 14 down  0.0000579    Abnormality of chromosome stability                 HP    
## 15 down  0.0000791    Sideroblastic anemia                                HP    
## 16 down  0.000247     Multiple cafe-au-lait spots                         HP    
## 17 down  0.000258     Global developmental delay                          HP    
## 18 up    0.000272     Recurrent paroxysmal headache                       HP    
## 19 down  0.00166      Abnormal brain morphology                           HP    
## 20 down  0.00186      Aplasia/Hypoplasia of the uvula                     HP    
## # A tibble: 19 × 4
##    query p_value term_name                                                source
##    <chr>   <dbl> <chr>                                                    <chr> 
##  1 down  0.00140 CENP-A NAC-CAD complex                                   CORUM 
##  2 down  0.00671 BRAFT complex                                            CORUM 
##  3 down  0.00671 BASC complex (BRCA1-associated genome surveillance comp… CORUM 
##  4 down  0.00676 CTF18-cohesion-RFC complex                               CORUM 
##  5 down  0.00676 FA core complex (Fanconi anemia core complex)            CORUM 
##  6 down  0.00754 PCNA-CHL12-RFC2-5 complex                                CORUM 
##  7 down  0.00754 CHTF18-RFC2-5 complex                                    CORUM 
##  8 down  0.00754 CHTF18-RFC2-5 complex                                    CORUM 
##  9 up    0.00925 Oligosaccharyltransferase complex (Stt3A variant)        CORUM 
## 10 down  0.0129  Fanconi anemia FAAP100 complex                           CORUM 
## 11 down  0.0237  CTF18-cohesion-RFC-POLH complex                          CORUM 
## 12 down  0.0237  FA complex (Fanconi anemia complex)                      CORUM 
## 13 down  0.0237  RC complex (Replication competent complex)               CORUM 
## 14 down  0.0237  BASC (Ab 80) complex (BRCA1-associated genome surveilla… CORUM 
## 15 up    0.0296  Oligosaccharyltransferase complex (Stt3B variant)        CORUM 
## 16 down  0.0309  CENP-H-I complex                                         CORUM 
## 17 down  0.0309  FA complex (Fanconi anemia complex)                      CORUM 
## 18 down  0.0397  Condensin I-PARP-1-XRCC1 complex                         CORUM 
## 19 down  0.0397  CENP-A NAC complex                                       CORUM
quickview_gprofiler_result(gprofiler_result_highlighted)
## # A tibble: 12 × 4
##    query  p_value term_name                                          source
##    <chr>    <dbl> <chr>                                              <chr> 
##  1 down  3.14e-79 nucleoplasm                                        GO:CC 
##  2 up    5.16e-68 cytoplasm                                          GO:CC 
##  3 down  1.29e-20 spindle                                            GO:CC 
##  4 down  1.42e-18 envelope                                           GO:CC 
##  5 down  1.26e- 5 Fanconi anaemia nuclear complex                    GO:CC 
##  6 down  1.14e- 3 spliceosomal complex                               GO:CC 
##  7 down  2.43e- 3 aminoacyl-tRNA synthetase multienzyme complex      GO:CC 
##  8 down  4.42e- 3 BRCA1-C complex                                    GO:CC 
##  9 down  2.79e- 2 cyclin-dependent protein kinase holoenzyme complex GO:CC 
## 10 up    3.70e- 2 laminin complex                                    GO:CC 
## 11 up    4.84e- 2 neuromuscular junction                             GO:CC 
## 12 down  5.00e- 2 FANCM-MHF complex                                  GO:CC 
## # A tibble: 20 × 4
##    query  p_value term_name                                            source
##    <chr>    <dbl> <chr>                                                <chr> 
##  1 down  3.91e-56 cell cycle                                           GO:BP 
##  2 down  4.13e-53 DNA metabolic process                                GO:BP 
##  3 down  7.13e-31 cell division                                        GO:BP 
##  4 up    2.43e-23 protein metabolic process                            GO:BP 
##  5 up    6.64e-12 vesicle-mediated transport                           GO:BP 
##  6 up    7.42e-10 organelle organization                               GO:BP 
##  7 down  1.37e- 9 small molecule metabolic process                     GO:BP 
##  8 down  1.92e- 9 ncRNA metabolic process                              GO:BP 
##  9 up    2.13e- 6 biological process involved in symbiotic interaction GO:BP 
## 10 down  2.31e- 6 protein localization to chromosome                   GO:BP 
## 11 down  1.70e- 5 nucleobase-containing compound transport             GO:BP 
## 12 up    6.83e- 5 oxidative phosphorylation                            GO:BP 
## 13 down  9.99e- 4 response to ionizing radiation                       GO:BP 
## 14 up    1.62e- 3 cellular component disassembly                       GO:BP 
## 15 down  1.65e- 3 RNA modification                                     GO:BP 
## 16 down  1.78e- 3 cellular component organization or biogenesis        GO:BP 
## 17 down  2.87e- 3 apoptotic process                                    GO:BP 
## 18 up    2.87e- 3 protein localization to Golgi apparatus              GO:BP 
## 19 up    7.77e- 3 phosphorus metabolic process                         GO:BP 
## 20 up    8.49e- 3 extracellular matrix organization                    GO:BP 
## # A tibble: 20 × 4
##    query  p_value term_name                                               source
##    <chr>    <dbl> <chr>                                                   <chr> 
##  1 down  6.91e-44 protein binding                                         GO:MF 
##  2 up    5.08e-36 protein binding                                         GO:MF 
##  3 down  4.97e-25 catalytic activity                                      GO:MF 
##  4 down  3.20e-13 single-stranded DNA binding                             GO:MF 
##  5 down  1.94e- 8 damaged DNA binding                                     GO:MF 
##  6 down  2.33e- 8 DNA secondary structure binding                         GO:MF 
##  7 up    2.21e- 7 enzyme regulator activity                               GO:MF 
##  8 down  5.91e- 4 chromatin binding                                       GO:MF 
##  9 down  6.34e- 4 magnesium ion binding                                   GO:MF 
## 10 down  2.74e- 3 oxidoreductase activity, acting on CH-OH group of dono… GO:MF 
## 11 down  3.27e- 3 mismatch repair complex binding                         GO:MF 
## 12 down  9.70e- 3 tubulin binding                                         GO:MF 
## 13 down  1.12e- 2 anaphase-promoting complex binding                      GO:MF 
## 14 up    1.16e- 2 metalloendopeptidase activity involved in amyloid prec… GO:MF 
## 15 up    2.47e- 2 insulin-like growth factor receptor binding             GO:MF 
## 16 down  2.74e- 2 DNA replication origin binding                          GO:MF 
## 17 up    3.16e- 2 catalytic activity                                      GO:MF 
## 18 up    3.44e- 2 molecular adaptor activity                              GO:MF 
## 19 up    3.52e- 2 cyclin-dependent protein serine/threonine kinase inhib… GO:MF 
## 20 up    3.75e- 2 insulin-like growth factor II binding                   GO:MF

Plot

unique(gprofiler_result_ordered$source) |> 
  walk(plot_dual_barplot_each_source, df = gprofiler_result_ordered)

## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_bar()`).
## Removed 1 row containing missing values or values outside the scale range
## (`geom_bar()`).

unique(gprofiler_result_notordered$source) |> 
  walk(plot_dual_barplot_each_source, df = gprofiler_result_notordered)

## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_bar()`).
## Removed 1 row containing missing values or values outside the scale range
## (`geom_bar()`).

unique(gprofiler_result_highlighted$source) |> 
  walk(plot_dual_barplot_each_source, df = gprofiler_result_highlighted)

Apoptosis

gprofiler_result_ordered |> 
  filter(query == 'up' & source == 'GO:BP') |> 
  arrange(p_value) |> 
  select(term_name, p_value) |> 
  head(n = 20)
## # A tibble: 20 × 2
##    term_name                                               p_value
##    <chr>                                                     <dbl>
##  1 protein maturation                                   0.00000545
##  2 endoderm formation                                   0.0000158 
##  3 endoderm development                                 0.000237  
##  4 protein catabolic process                            0.000592  
##  5 formation of primary germ layer                      0.000788  
##  6 protein metabolic process                            0.000932  
##  7 organonitrogen compound catabolic process            0.000988  
##  8 vesicle-mediated transport                           0.00133   
##  9 amyloid precursor protein catabolic process          0.00136   
## 10 macromolecule catabolic process                      0.00155   
## 11 gastrulation                                         0.00167   
## 12 Golgi vesicle transport                              0.00192   
## 13 protein processing                                   0.00215   
## 14 embryonic placenta morphogenesis                     0.00227   
## 15 proteolysis                                          0.00271   
## 16 positive regulation of apoptotic process             0.00351   
## 17 positive regulation of programmed cell death         0.00355   
## 18 amyloid precursor protein metabolic process          0.00367   
## 19 biological process involved in symbiotic interaction 0.00395   
## 20 regulation of plasminogen activation                 0.00499
gprofiler_result_notordered |> 
  filter(query == 'up' & source == 'GO:BP') |> 
  arrange(p_value) |> 
  select(term_name, p_value) |> 
  head(n = 20)
## # A tibble: 20 × 2
##    term_name                                  p_value
##    <chr>                                        <dbl>
##  1 protein metabolic process                 2.43e-23
##  2 organonitrogen compound metabolic process 3.92e-23
##  3 catabolic process                         6.00e-13
##  4 vesicle-mediated transport                6.64e-12
##  5 organonitrogen compound catabolic process 2.01e-11
##  6 regulation of response to stimulus        3.00e-11
##  7 proteolysis                               3.17e-11
##  8 protein maturation                        3.29e-11
##  9 macromolecule catabolic process           7.79e-11
## 10 regulation of signal transduction         1.07e-10
## 11 tissue development                        1.72e-10
## 12 organic substance catabolic process       1.81e-10
## 13 cell death                                2.01e-10
## 14 programmed cell death                     3.09e-10
## 15 protein catabolic process                 3.16e-10
## 16 organelle organization                    7.42e-10
## 17 anatomical structure development          7.77e-10
## 18 positive regulation of cellular process   9.85e-10
## 19 positive regulation of biological process 1.15e- 9
## 20 apoptotic process                         1.35e- 9

TF (to remove –)

TF_remove_patterns <- 'Factor: |; match class: [0-9]+'
gprofiler_result_ordered_TF <- 
  gprofiler_result_ordered |> 
  filter(source == 'TF') |> 
  mutate(
    term_name = paste0(
      term_name |> 
        str_remove_all(TF_remove_patterns) |> 
        str_replace('; motif: ', ' (') |> 
        str_remove(';'),
      ')'
    )
  )

plot_dual_barplot_each_source('TF', gprofiler_result_ordered_TF)
## Warning: Removed 1 row containing missing values or values outside the scale range
## (`geom_bar()`).
## Removed 1 row containing missing values or values outside the scale range
## (`geom_bar()`).